package org.example.controller;


import org.example.api.ProductInterface;
import org.example.model.ProductInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
@RequestMapping("/feign")
public class FeignController {
    /**
     * 抽取式的话，也同样需要将controller完善好方法
     */
    @Autowired
    private ProductInterface productInterface;
    @RequestMapping("/o1")
    public String o1(Integer id) {
       return  productInterface.p1(id);
    }
    @RequestMapping("/o2")
    public String o2(Integer id, String name) {
        return  productInterface.p2(id,name);
    }
    @RequestMapping("/o3")
    public String o3() {
        ProductInfo productInfo = new ProductInfo();
        productInfo.setId(45);
        productInfo.setProductName("张三");
        return  productInterface.p3(productInfo);
    }
    @RequestMapping("/o4")
    public String o4() {
        ProductInfo productInfo = new ProductInfo();
        productInfo.setId(45);
        productInfo.setProductName("张三");
        return  productInterface.p4(productInfo);
    }
}
